class Student(object):
    count = 0

    def __init__(self, name):
        self.name = name
        # 类实例化时，每实例化一次+1
        Student.count += 1

    @classmethod
    def print_student_count(cls):
        print("Student.count = {0}".format(cls.count))


if __name__ == '__main__':
    # 第一次实例化 : count = 1
    Student('name1')
    # 第二次实例化 : count = 2
    Student('name2')
    # Student.count = 2
    Student.print_student_count()
    # 第三次实例化 : count = 3
    Student('name3')
    # Student.count = 3
    Student.print_student_count()
